import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    proxy: {
      '/api': {
        target: 'https://gitee.com/api/v5/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
      '/auth': {
        target: 'https://gitee.com/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/auth/, ''),
        configure: (proxy, options) => {
          // proxy 是 'http-proxy' 的实例
          console.log('proxy' + proxy);
          console.log('options' + options);
        },
      },
    },
  },
});
